<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<title>订单查询</title>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
	<style type="text/css" >
		.nav-font-c{
			color: #007bff;
		}
		.order-info{
			font-size: 12px;
			font-family: "微软雅黑";


		}
	</style>
</head>
<body>
<div class="container-fluid " style="height: 42px;background: #8bcc93">
  	<div class="container pt-2" style="color: #fff">
  		<div class="float-left" style="font-size: 12px;">
  				<span class="un-login-user-name" style="font-size:13px;cursor:pointer;" >亲 ~~ 您好</span>

  				<span class="login-userSpan" style="font-size:12px;cursor:pointer;" > 您好 : &nbsp;
			 		<span class="login-user-name" style="font-size: 14px;color: #0062cc;cursor:pointer;"> </span>
				</span>
  		</div>
		<div class="float-right">
			<div class="fl-r-unlogin" >
				<span class="user-help" style="font-size: 13px;color: #0062cc;cursor:pointer;">帮助</span>
				<span id="user-longin" class="ml-3" style="font-size: 13px;color: #0062cc;cursor:pointer;" >登录</span>
				<span id="user-register" style="font-size: 13px;color: #0062cc;cursor:pointer;"  class="ml-3">注册</span>
			</div>
			<div class="fl-r-login" style="display: none;" >
				<span class="user-help" style="font-size: 13px;color: #0062cc;cursor:pointer;">帮助</span>
				<span id="user-relongin" style="font-size: 12px;color: #0062cc;cursor:pointer;" class="ml-3" >重新登录</span>
			</div>
		</div>

		<div class="float-none"></div>
	</div>
</div>

<div class="container mt-3">

	<ul class="nav nav-tabs" id="myTab" role="tablist">
	  <li class="nav-item  nav-font-c index-html">
	    <a class="nav-link"  data-toggle="tab"  role="tab"  >首页</a>
	  </li>
	  <li class="nav-item search-order-html">
	    <a class="nav-link active" data-toggle="tab" role="tab" >订单查询</a>
	  </li>
	  <li class="nav-item nav-font-c settlement-html">
	    <a class="nav-link"  data-toggle="tab"  role="tab"  >结算</a>
	  </li>


	</ul>

	<br />
	<span style="color: #666;font-size: 12px;">查询过的订单都会绑定到当前登录账号</span><br />
	<span style="color: #666;font-size: 12px;">所以在自己查询之前订单号请保密哟</span><br /><br />
	<span style="color: red;font-size: 14px;">订单库上次更新时间 : <span class="orders-update-time">2017-11-11 01:12:17</span> </span><br />
	<div class="input-group mt-1 mb-5">
		<input type="text" class="form-control q-order-number" placeholder="请输入您的订单号"  />
		<span class="input-group-btn">
			<button class="btn btn-primary b-order-number" type="button">
				查询
			</button>
		</span>
	</div>

	<div class="order-info-div" style="display: none;">
		<span class="order-info">订单号：
			<span class="o-info-orderNo" style="color: green"></span>
			
		</span> <br />
		<span class="order-info-staues">订单状态：
			<span class="o-info-status" style="color: green"></span>
			
		</span> <br />
		<span class="order-info">返利金额：
			
			<span class="o-info-returnMoney" style="color: green"></span>
		</span> <br />
		<span class="order-info">是否提现：
			
			<span class="o-info-returnStatus" style="color: green"></span>
		</span> <br />
		<span class="order-info">订单拥有用户：
			
			<span class="o-info-order-username" style="color: green"></span>
		</span>


	</div>
	<hr />
	<span style="color: red;font-size: 12px;">你的订单在订单库更新时间之前生成才会查询到订单</span><br />
	<span style="color: #666;font-size: 12px;">并且订单库更新后才会查询到订单的最新状态哟！</span><br />
	<span style="color: #666;font-size: 12px;">一般1到2天更新一次订单库</span>

	<!-- <ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">
	  <li class="nav-item">
	    <a class="nav-link active" id="pills-home-tab" data-toggle="pill" href="#pills-home" role="tab" aria-controls="pills-home" aria-selected="true">自己订单</a>
	  </li>

	  <li class="nav-item">
	    <a class="nav-link" id="pills-profile-tab" data-toggle="pill" href="#pills-profile" role="tab" aria-controls="pills-profile" aria-selected="false">邀请码订单</a>
	  </li>
	 
	</ul>
	<div class="tab-content" id="pills-tabContent">
	
	  <div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab">
	  	
		1
	  </div>

	  <div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab">
	  	
		2
	  </div>
	 
	</div> -->

	
</div>

<!-- jQuery first, then Tether, then Bootstrap JS.  B-->

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
 
<!-- jQuery first, then Tether, then Bootstrap JS. E -->

<script>

function dataFromt(longTime){
	var date = new Date(longTime);

	Y = date.getFullYear() + '-';
	M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
	D = date.getDate() + ' ';
	h = date.getHours() + ':';
	m = date.getMinutes() + ':';
	s = date.getSeconds();
	return Y+M+D+h+m+s;
}

function sysTime(){
	$.ajax({
		   type: "POST",
		   url: "/mytk/tkSysUpda/getOne",
		   dataType:"json",
		   success: function(msg){

			   	console.info(msg)

			   	if(msg.code == 200){
			   		$('.orders-update-time').text(dataFromt(msg.body.lastTime));
			   	}else{
			   		alert(msg.msg)
			   	}

		   },
		   error: function(XMLHttpRequest, textStatus, errorThrown) {

				alert("请求失败！请联系管理员");
		   }
		})
}
sysTime();

(function(){

	function trim(s){
	    return s.replace(/(^\s*)|(\s*$)/g, "");
	}

	$(".b-order-number").off().on("click",function(){

		var  orderNumber = trim($('.q-order-number').val());
		if(!orderNumber ||orderNumber.length == 0){
			alert("订单号不能为空");
			return  false;

		}
		
		$.ajax({
		   type: "POST",
		   url: "/mytk/tkOrder/getOne",
		   data: "orderNumber="+orderNumber,
		   dataType:"json",
		   success: function(msg){
			   	console.info(msg)
			   	if(msg.code == 200){

			   		if(!msg.body){
			   			alert("无效订单号");
			   			return;
			   		}
			   		$(".order-info-div").show();
					$('.o-info-orderNo').text(msg.body.orderNumber);
					var orderStatus = msg.body.orderStatus;
					//订单状态( 0订单付款    1 订单结算  5订单失效 )
					if(orderStatus == 0){
						orderStatus = "订单付款";
					}else if(orderStatus == 1){
						orderStatus = "订单已经结算";
					}else if(orderStatus == 5){
						orderStatus = "订单失效";
						$('.o-info-status').css('color','red');
					};

					$('.o-info-status').text(orderStatus);
					$('.o-info-returnMoney').text(msg.body.userReturnMoney+"元");
					var returnStatus = msg.body.userReturnStatus;
					//用户返利状态 ( 0 未返利    1 已经返利   2,处理中 )
					if(returnStatus == 0){
						returnStatus = "否";
					}else if(returnStatus == 1){
						returnStatus = "是";
					}else if(returnStatus == 2){
						returnStatus = "处理中";
					}

					$('.o-info-returnStatus').text(returnStatus);

					$('.o-info-order-username').text(msg.body.userName);


			   		
			   	}else{
			   		alert(msg.msg)
			   	}

		   },
		   error: function(XMLHttpRequest, textStatus, errorThrown) {

				alert("请求失败！请联系管理员");
		   }
		})

	});
	$(".user-help").off().on("click", function(){

			window.location.href='use-help.html';
	});

	$(".index-html").off().on("click", function(){
		
		window.location.href='index.html';
	});
	$("#user-longin").off().on("click", function(){
			
			window.location.href='longin-register.html';
	});
	$("#user-relongin").off().on("click", function(){
			
			window.location.href='longin-register.html';
	});
	$("#user-register").off().on("click", function(){
			
			window.location.href='longin-register.html?regPar=reg';
	});
	$(".settlement-html").off().on("click", function(){
			
			window.location.href='settlement.html';
	});
	$(".login-user-name").off().on("click", function(){

			window.location.href='user-info.html';
	});

}())
function init (){
	$.ajax({
		   type: "POST",
		   url: "/mytk/tklUser/webToken",
		   dataType:"json",
		   success: function(msg){
		   
			   	console.info(msg)
		
			   	if(msg.code == 200){
			   		
			   		$('.un-login-user-name').hide();
			   		$('.login-user-name').text(msg.body.name);

			   		$('.login-userSpan').show();

			   		$('.fl-r-unlogin').hide();
			   		$('.fl-r-login').show();
			   		
			   	}else{
			   		alert(msg.msg)
			   		window.location.href='index.html';
			   	}
			   	
		   },
		   error: function(XMLHttpRequest, textStatus, errorThrown) {
	
				alert("请求失败！请联系管理员");
		   }
		})

}

init();
</script>
</body>
</html>